using System;
using System.Collections;

namespace Sedna.Core.Controller.Menu
{
	public class Menu : GenericConfiguration, IMenu
	{

		private IList menuItems;

		private static MenuItem empty = new MenuItem();

		public IList MenuItems
		{
			get { return menuItems; }
			set { menuItems = value; }
		}

		public IMenuItem Empty
		{
			get
			{
				return empty;
			}
		}


		public IMenuItem GetMenuItemById(string id)
		{
			foreach(IMenuItem menuItem in menuItems)
			{
				if(menuItem.Id == id)
				{
					return menuItem;
				}
				IMenuItem tmpMenuItem = menuItem.GetMenuItemById(id);
				if(tmpMenuItem != null)
				{
					return tmpMenuItem;
				}
			}
			return null;
		}

	}
}
